/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.pacis.shca.domain.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;

/**
 *
 * @author solriver
 */
@Entity
@Table(name = "departamento", catalog = "bdshca")
@NamedQueries({
    @NamedQuery(name = "Departamento.findAll", query = "SELECT d FROM Departamento d"),
    @NamedQuery(name = "Departamento.findByCcdd", query = "SELECT d FROM Departamento d WHERE d.ccdd = :ccdd"),
    @NamedQuery(name = "Departamento.findByNombredd", query = "SELECT d FROM Departamento d WHERE d.nombredd = :nombredd")})
public class Departamento implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "CCDD")
    private String ccdd;
    @Column(name = "NOMBREDD")
    private String nombredd;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "departamento")
    private List<Provincia> provinciaList;

    public Departamento() {
    }

    public Departamento(String ccdd) {
        this.ccdd = ccdd;
    }

    public String getCcdd() {
        return ccdd;
    }

    public void setCcdd(String ccdd) {
        this.ccdd = ccdd;
    }

    public String getNombredd() {
        return nombredd;
    }

    public void setNombredd(String nombredd) {
        this.nombredd = nombredd;
    }

    public List<Provincia> getProvinciaList() {
        return provinciaList;
    }

    public void setProvinciaList(List<Provincia> provinciaList) {
        this.provinciaList = provinciaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ccdd != null ? ccdd.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Departamento)) {
            return false;
        }
        Departamento other = (Departamento) object;
        if ((this.ccdd == null && other.ccdd != null) || (this.ccdd != null && !this.ccdd.equals(other.ccdd))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.pacis.shca.domain.entity.Departamento[ ccdd=" + ccdd + " ]";
    }
    
}
